#pragma once

class Window{
public:
	HINSTANCE	inst;
	HWND		hwnd;

	Window	(void){};
	Window	(HINSTANCE,LPCTSTR,Window *parent=0,LPARAM param=0);

	void	hide			(void);
	int		messageLoop		(void);
	void	registerClass	(void);
	LRESULT	sendMessage		(uint,WPARAM,LPARAM);
	void	setFocus		(void);
	void	show			(int=SW_SHOW);
	void	update			(void);

	static void	setCursor		(HCURSOR);

protected:
	virtual PTSTR	className		(void);
	virtual LRESULT onCommand		(WPARAM,LPARAM);
	virtual LRESULT	onCreate		(LPARAM);
	virtual void	onDestroy		(void);
	virtual LRESULT	onDeviceChange	(WPARAM,LPARAM);
	virtual void	onEraseBkgnd	(WPARAM,LPARAM);
	virtual void	onMove			(WPARAM,LPARAM);
	virtual void	onPaint			(void);
	virtual void	onSize			(WPARAM,LPARAM);
	virtual LRESULT onUser			(uint,WPARAM,LPARAM);

private:
	static LRESULT			onCreate(HWND,LPARAM);
	static LRESULT CALLBACK	wndProc	(HWND,UINT,WPARAM,LPARAM);

};